﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <link href="~/Content/css/reset.css" rel="stylesheet" />
    <link href="~/Content/css/style.css" rel="stylesheet" />
    <link href="~/Content/css/supersized.css" rel="stylesheet" />
    <script src="~/Scripts/jquery-2.1.1.min.js"></script>
    <script src="~/Scripts/layer/layer.js"></script>
    <title>登录</title>
    <script>

        window.onload = function () {
            $(".connect p").eq(0).animate({ "left": "0%" }, 600);
            $(".connect p").eq(1).animate({ "left": "0%" }, 400);
            $(".username").focus();
            $("body").keydown(function () {
                if (event.keyCode == "13") {//keyCode=13是回车键
                    $('#submit').trigger('click');
                }
            });
        }
        //登录
        function GetLogin() {

            var userName = $(".username").val();
            var userPwd = $(".password").val();
            if (userName == '' || userPwd == '') {
                layer.msg("请输入用户名和密码！");
            } else {
                $.ajax({
                    type: "Post",
                    url: "/Login/GetLogin",
                    data: { "userName": userName, "userPwd": userPwd },
                    dataType: "json",
                    success: function (data) {
                        //alert(JSON.stringify(data));
                        if (data == "") {
                            layer.msg("用户名或密码错误！");
                            return;
                        } else if (data.IsAdmin == '0') {
                            layer.msg("请使用管理员帐号登录！");
                            return;

                        } else {
                            layer.msg("登录成功！");
                            window.location.href = "/Account/Index";
                        }
                    }
                })
            }
        }
    </script>
</head>
<body oncontextmenu="return false" style="background-image: url(../Content/images/2.jpg); background-repeat: no-repeat; background-size: 100%;">
    <div class="page-container" style="margin-top:15%;">
        <h1>登录</h1>
        <form action="" method="post">
            <div>
                <input type="text" name="username" class="username" placeholder="输入你的帐号" autocomplete="off" />
            </div>
            <div>
                <input type="password" name="password" class="password" placeholder="输入你的密码" oncontextmenu="return false" onpaste="return false" />
            </div>
            <button id="submit" type="button" onclick="GetLogin();" style="font-size:18px;">登录</button>
        </form>
        <div class="connect">
            <p>If we can only encounter each other rather than stay with each other,then I wish we had never encountered.</p>
            <p style="margin-top:20px;">如果只是遇见，不能停留，不如不遇见。</p>
        </div>
    </div>
</body>

</html>
